#if !GENERATOR

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Collections.Generic;

using YF.OneNote;


namespace YF.OneNote.DataTypes
{
  using Collections;


  public partial class OpenSections
  {
    public OpenSections()
    {
      _sections.CollectionChanged += _sections_CollectionChanged;
	}

    
    private void _sections_CollectionChanged(object sender, NotifyCollectionChangedEventArgs<Section> e)
    {
      switch (e.Action)
      {
        case NotifyCollectionChangedAction.Add:
        {
          foreach (Section item in e.NewItems)
            Children.Add(item);
        }
          break;

        case NotifyCollectionChangedAction.Remove:
        {
          foreach (Section item in e.OldItems)
            Children.Remove(item);
        }
          break;
      }
    }

  
    protected override bool UpdateSpecificContents(NotesHierarchyNode node, List<INotesChange> changes)
    {
	  OpenSections item = (OpenSections)node;
      bool changed = false;

      
      if (isCurrentlyViewed != item.isCurrentlyViewed)
      {
        changed = true;
		
		NotesPropertyChange propertyChange = new NotesPropertyChange();

        propertyChange.ChangeType = NoteChangeType.Changed;
        propertyChange.OldValue = isCurrentlyViewedField;
        propertyChange.NewValue = item.isCurrentlyViewedField;
        propertyChange.PropertyName = "isCurrentlyViewed";
        changes.Add(propertyChange);

		
        isCurrentlyViewedField = item.isCurrentlyViewedField;
      }

      if (UpdateCollection(Sections, item.Sections, changes))
        changed = true;


      return changed;
    }
  }
}

#endif